var t = require("../@babel/runtime/helpers/interopRequireDefault")(require("../@babel/runtime/helpers/typeof"));

module.exports = {
  dayjs: function() {
    var e = "millisecond",
      n = "second",
      r = "minute",
      i = "hour",
      s = "day",
      u = "week",
      a = "month",
      o = "quarter",
      h = "year",
      f = /^(\d{4})-?(\d{1,2})-?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d{1,3})?$/,
      c = /\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,
      d = function(t, e, n) {
        var r = String(t);
        return !r || r.length >= e ? t : "" + Array(e + 1 - r.length).join(n) + t;
      },
      $ = {
        s: d,
        z: function(t) {
          var e = -t.utcOffset(),
            n = Math.abs(e),
            r = Math.floor(n / 60),
            i = n % 60;
          return (e <= 0 ? "+" : "-") + d(r, 2, "0") + ":" + d(i, 2, "0");
        },
        m: function(t, e) {
          var n = 12 * (e.year() - t.year()) + (e.month() - t.month()),
            r = t.clone().add(n, a),
            i = e - r < 0,
            s = t.clone().add(n + (i ? -1 : 1), a);
          return Number(-(n + (e - r) / (i ? r - s : s - r)) || 0);
        },
        a: function(t) {
          return t < 0 ? Math.ceil(t) || 0 : Math.floor(t);
        },
        p: function(t) {
          return {
            M: a,
            y: h,
            w: u,
            d: s,
            D: "date",
            h: i,
            m: r,
            s: n,
            ms: e,
            Q: o
          }[t] || String(t || "").toLowerCase().replace(/s$/, "");
        },
        u: function(t) {
          return void 0 === t;
        }
      },
      l = {
        name: "en",
        weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
        months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_")
      },
      m = "en",
      M = {};
    M[m] = l;
    var y = function(t) {
        return t instanceof S;
      },
      g = function(t, e, n) {
        var r;
        if (!t) return m;
        if ("string" == typeof t) M[t] && (r = t), e && (M[t] = e, r = t);
        else {
          var i = t.name;
          M[i] = t, r = i;
        }
        return !n && r && (m = r), r || !n && m;
      },
      D = function(e, n) {
        if (y(e)) return e.clone();
        var r = "object" == (0, t.default)(n) ? n : {};
        return r.date = e, r.args = arguments, new S(r);
      },
      v = $;
    v.l = g, v.i = y, v.w = function(t, e) {
      return D(t, {
        locale: e.$L,
        utc: e.$u,
        $offset: e.$offset
      });
    };
    var S = function() {
      function t(t) {
        this.$L = this.$L || g(t.locale, null, !0), this.parse(t);
      }
      var d = t.prototype;
      return d.parse = function(t) {
        this.$d = function(t) {
          var e = t.date,
            n = t.utc;
          if (null === e) return new Date(NaN);
          if (v.u(e)) return new Date();
          if (e instanceof Date) return new Date(e);
          if ("string" == typeof e && !/Z$/i.test(e)) {
            var r = e.match(f);
            if (r) return n ? new Date(Date.UTC(r[1], r[2] - 1, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, r[7] || 0)) : new Date(r[1], r[2] - 1, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, r[7] || 0);
          }
          return new Date(e);
        }(t), this.init();
      }, d.init = function() {
        var t = this.$d;
        this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(),
          this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
      }, d.$utils = function() {
        return v;
      }, d.isValid = function() {
        return !("Invalid Date" === this.$d.toString());
      }, d.isSame = function(t, e) {
        var n = D(t);
        return this.startOf(e) <= n && n <= this.endOf(e);
      }, d.isAfter = function(t, e) {
        return D(t) < this.startOf(e);
      }, d.isBefore = function(t, e) {
        return this.endOf(e) < D(t);
      }, d.$g = function(t, e, n) {
        return v.u(t) ? this[e] : this.set(n, t);
      }, d.year = function(t) {
        return this.$g(t, "$y", h);
      }, d.month = function(t) {
        return this.$g(t, "$M", a);
      }, d.day = function(t) {
        return this.$g(t, "$W", s);
      }, d.date = function(t) {
        return this.$g(t, "$D", "date");
      }, d.hour = function(t) {
        return this.$g(t, "$H", i);
      }, d.minute = function(t) {
        return this.$g(t, "$m", r);
      }, d.second = function(t) {
        return this.$g(t, "$s", n);
      }, d.millisecond = function(t) {
        return this.$g(t, "$ms", e);
      }, d.unix = function() {
        return Math.floor(this.valueOf() / 1e3);
      }, d.valueOf = function() {
        return this.$d.getTime();
      }, d.startOf = function(t, e) {
        var o = this,
          f = !!v.u(e) || e,
          c = v.p(t),
          d = function(t, e) {
            var n = v.w(o.$u ? Date.UTC(o.$y, e, t) : new Date(o.$y, e, t), o);
            return f ? n : n.endOf(s);
          },
          $ = function(t, e) {
            return v.w(o.toDate()[t].apply(o.toDate("s"), (f ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e)), o);
          },
          l = this.$W,
          m = this.$M,
          M = this.$D,
          y = "set" + (this.$u ? "UTC" : "");
        switch (c) {
          case h:
            return f ? d(1, 0) : d(31, 11);

          case a:
            return f ? d(1, m) : d(0, m + 1);

          case u:
            var g = this.$locale().weekStart || 0,
              D = (l < g ? l + 7 : l) - g;
            return d(f ? M - D : M + (6 - D), m);

          case s:
          case "date":
            return $(y + "Hours", 0);

          case i:
            return $(y + "Minutes", 1);

          case r:
            return $(y + "Seconds", 2);

          case n:
            return $(y + "Milliseconds", 3);

          default:
            return this.clone();
        }
      }, d.endOf = function(t) {
        return this.startOf(t, !1);
      }, d.$set = function(t, u) {
        var o, f = v.p(t),
          c = "set" + (this.$u ? "UTC" : ""),
          d = (o = {}, o[s] = c + "Date",
            o.date = c + "Date", o[a] = c + "Month", o[h] = c + "FullYear", o[i] = c + "Hours",
            o[r] = c + "Minutes", o[n] = c + "Seconds", o[e] = c + "Milliseconds", o)[f],
          $ = f === s ? this.$D + (u - this.$W) : u;
        if (f === a || f === h) {
          var l = this.clone().set("date", 1);
          l.$d[d]($), l.init(), this.$d = l.set("date", Math.min(this.$D, l.daysInMonth())).toDate();
        } else d && this.$d[d]($);
        return this.init(), this;
      }, d.set = function(t, e) {
        return this.clone().$set(t, e);
      }, d.get = function(t) {
        return this[v.p(t)]();
      }, d.add = function(t, e) {
        var o, f = this;
        t = Number(t);
        var c = v.p(e),
          d = function(e) {
            var n = D(f);
            return v.w(n.date(n.date() + Math.round(e * t)), f);
          };
        if (c === a) return this.set(a, this.$M + t);
        if (c === h) return this.set(h, this.$y + t);
        if (c === s) return d(1);
        if (c === u) return d(7);
        var $ = (o = {}, o[r] = 6e4, o[i] = 36e5, o[n] = 1e3, o)[c] || 1,
          l = this.$d.getTime() + t * $;
        return v.w(l, this);
      }, d.subtract = function(t, e) {
        return this.add(-1 * t, e);
      }, d.format = function(t) {
        var e = this;
        if (!this.isValid()) return "Invalid Date";
        var n = t || "YYYY-MM-DDTHH:mm:ssZ",
          r = v.z(this),
          i = this.$locale(),
          s = this.$H,
          u = this.$m,
          a = this.$M,
          o = i.weekdays,
          h = i.months,
          f = function(t, r, i, s) {
            return t && (t[r] || t(e, n)) || i[r].substr(0, s);
          },
          d = function(t) {
            return v.s(s % 12 || 12, t, "0");
          },
          $ = i.meridiem || function(t, e, n) {
            var r = t < 12 ? "AM" : "PM";
            return n ? r.toLowerCase() : r;
          },
          l = {
            YY: String(this.$y).slice(-2),
            YYYY: this.$y,
            M: a + 1,
            MM: v.s(a + 1, 2, "0"),
            MMM: f(i.monthsShort, a, h, 3),
            MMMM: h[a] || h(this, n),
            D: this.$D,
            DD: v.s(this.$D, 2, "0"),
            d: String(this.$W),
            dd: f(i.weekdaysMin, this.$W, o, 2),
            ddd: f(i.weekdaysShort, this.$W, o, 3),
            dddd: o[this.$W],
            H: String(s),
            HH: v.s(s, 2, "0"),
            h: d(1),
            hh: d(2),
            a: $(s, u, !0),
            A: $(s, u, !1),
            m: String(u),
            mm: v.s(u, 2, "0"),
            s: String(this.$s),
            ss: v.s(this.$s, 2, "0"),
            SSS: v.s(this.$ms, 3, "0"),
            Z: r
          };
        return n.replace(c, function(t, e) {
          return e || l[t] || r.replace(":", "");
        });
      }, d.utcOffset = function() {
        return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
      }, d.diff = function(t, e, f) {
        var c, d = v.p(e),
          $ = D(t),
          l = 6e4 * ($.utcOffset() - this.utcOffset()),
          m = this - $,
          M = v.m(this, $);
        return M = (c = {}, c[h] = M / 12, c[a] = M, c[o] = M / 3, c[u] = (m - l) / 6048e5,
            c[s] = (m - l) / 864e5, c[i] = m / 36e5, c[r] = m / 6e4, c[n] = m / 1e3, c)[d] || m,
          f ? M : v.a(M);
      }, d.daysInMonth = function() {
        return this.endOf(a).$D;
      }, d.$locale = function() {
        return M[this.$L];
      }, d.locale = function(t, e) {
        if (!t) return this.$L;
        var n = this.clone(),
          r = g(t, e, !0);
        return r && (n.$L = r), n;
      }, d.clone = function() {
        return v.w(this.$d, this);
      }, d.toDate = function() {
        return new Date(this.valueOf());
      }, d.toJSON = function() {
        return this.isValid() ? this.toISOString() : null;
      }, d.toISOString = function() {
        return this.$d.toISOString();
      }, d.toString = function() {
        return this.$d.toUTCString();
      }, t;
    }();
    return D.prototype = S.prototype, D.extend = function(t, e) {
      return t(e, S, D), D;
    }, D.locale = g, D.isDayjs = y, D.unix = function(t) {
      return D(1e3 * t);
    }, D.en = M[m], D.Ls = M, D;
  }()
};